package edu.buaa.act.travel.m.tpdl.moveaction;


public class MoveActionFactory {

	private static MoveActionFactory factory;

	private MoveActionFactory() {

	}

	public static MoveActionFactory getInstance() {
		if (factory == null) {
			synchronized (MoveActionFactory.class) {
				if (factory == null) {
					factory = new MoveActionFactory();
				}
			}
		}
		return factory;
	}

	public MoveAction create(String type) {
		if (BusAction.TYPE.equals(type)) {
			return new BusAction();
		} else if (WalkAction.TYPE.equals(type)) {
			return new WalkAction();
		} else {
			System.out.println("unexcepted type :" + type);
			return null;
		}
	}
}
